import { Injectable, Inject } from '@nestjs/common';
import {
  UseClassLoggerService, UseValueLoggerService, UseFactoryLoggerService,
  UseValueLoggerServiceStringToken
} from './logger.service';

import { DownloadService } from './download.service';

// 模拟服务业务
// 每个服务都需要注册

// 可被注入别的服务,可以在一个服务里依赖别的服务
@Injectable()
export class AppService {
  constructor(
    private UserClassLoggerService: UseClassLoggerService,
    private UseValueLoggerService: UseValueLoggerService,
    private UseFactoryLoggerService: UseFactoryLoggerService,
    @Inject('StringToken') private UseValueLoggerServiceStringToken: UseValueLoggerServiceStringToken, // 重新定义了token，用StringToken 去找

    private readonly DownloadService: DownloadService,
  ) {
    this.main();
  }

  async main(){
    await this.DownloadService.getEarnings()
  }

  // getHello(): string {
  //   this.UserClassLoggerService.log('UserClassLoggerService')
  //   this.UseValueLoggerService.log('UseValueLoggerService')
  //   this.UseFactoryLoggerService.log('UseFactoryLoggerService')
  //   this.UseValueLoggerServiceStringToken.log('UseValueLoggerServiceStringToken')
  //   return 'Hello World!';
  // }
}
